<div ng-controller="DriverSearchCtrl as vm">
  <h1 class="page-title">搜索司机</h1>
  <div class="well">
     <form method='POST' action='/api/driver/export'>
    <div class="form-horizontal" ng-submit="">
        <fieldset>
            <div class="control-group">
                <!-- Text input-->
                <label class="control-label">姓名</label>
                <div class="controls">
                    <input type="text" name="name" placeholder="" class="input-xlarge" ng-model="vm.driver.name">
                    <p class="help-block"></p>
                </div>
            </div>
            <div class="control-group">
                <!-- Text input-->
                <label class="control-label">手机号</label>
                <div class="controls">
                    <input type="text" name="phoneNumber" placeholder="" class="input-xlarge" ng-model="vm.driver.phoneNumber">
                    <p class="help-block"></p>
                </div>
            </div>
            <div class="control-group">
                <!-- Text input-->
                <label class="control-label">身份证号</label>
                <div class="controls">
                    <input type="text" name="idNumber" placeholder="" class="input-xlarge" ng-model="vm.driver.idNumber">
                    <p class="help-block"></p>
                </div>
            </div>
            <div class="control-group">
                <label class="control-label"></label>
                <!-- Button -->
                <div class="controls">
                    <a class="btn btn-primary" ng-click="vm.searchDriver()">搜索</a>
                </div>
            </div>
        </fieldset>
  </div>
  <p ng-show="vm.noRecord">没有找到符合条件的司机！</p>
  <div class="table-responsive" ng-show="vm.drivers.length>0">
            <button class="btn" type="submit">导出结果</button>
    <table class="table table-striped table-bordered">
      <thead>
        <tr>
          <th>姓名</th>
          <th>手机号</th>
          <th>驾龄</th>
          <th>驾驶证有效期</th>
          <th>身份证</th>
          <th ng-show="vm.userRole=='admin'">所属个人用户</th>
          <th>审核通过？</th>
          <th>是否有效？</th>
          <th></th>
        </tr>
      </thead>
      <tbody>
        <tr ng-repeat="driver in vm.drivers">
          <td><a ng-click="vm.viewDetail(driver.id)">{{driver.name}}</a></td>
          <td>{{driver.phoneNumber}}</td>
          <td>{{driver.firstLicenseDate | toAge}}</td>
          <td>{{driver.licenseValidTo | date:"yyyy-MM-dd"}}</td>
          <td>{{driver.idNumber}}</td>
          <td ng-show="vm.userRole=='admin'">{{driver.carrier.user.memberId}}</td>
          <td ng-switch='driver.approvalStatus'>
              <div ng-switch-when="0">未审核</div>
              <div ng-switch-when="1">审核中</div>
              <div ng-switch-when="2">审核通过</div>
              <div ng-switch-when="3">审核未通过</div>
            </td>
            <td>{{driver.valid? '有效':'黑名单'}}</td>
          <td><a class="btn btn-primary btn-mini" ng-click="vm.viewDetail(driver.id)">查看</a>
          <a class="btn btn-mini btn-danger" ng-show="driver.approvalStatus==0" ng-click="vm.submitVerify(driver.id)">提交审核</a></td>
        </tr>
      </tbody>
    </table>
    <div class="pagination pagination-centered">
        <ul>
         <li ng-class="vm.firstPage? 'disabled':''" ng-switch="vm.firstPage">
         <a ng-switch-when="false" ng-click="vm.loadPage(vm.currentPage-1)" >&laquo;</a>
         <a ng-switch-when="true" >&laquo;</a>
         </li>
          <li ng-repeat="me in vm.pages" ng-class="me==vm.currentPage? 'active':''" ng-switch="me==vm.currentPage">
            <a ng-switch-when="false" ng-click="vm.loadPage(me)" >{{me}}</a>
            <a ng-switch-when="true" >{{me}}</a>
            </li>
          <li ng-class="vm.lastPage? 'disabled':''" ng-switch on="vm.lastPage">
          <a ng-switch-when="false" ng-click="vm.loadPage(vm.currentPage+1)">&raquo;</a>
          <a ng-switch-when="true" >&raquo;</a>
          </li>
        </ul>
      </div>
  </div>
</div>
</div>